<template>
  <div class="btn_wrap">
    <button
      class="y-button"
      :class="{'is-disabled':disabled}"
      :type="type"
      :disabled="disabled"
      @click="$emit('click')"
    >
      <!-- :class="{'is-disabled':disabled}" 不可用的样式  -->
      <!-- :disabled="disabled" 判断能不能用 -->
      <slot></slot>
      <!-- slot 用为写button显示的名字;如登录或者注册 -->
    </button>
  </div>

</template>
<script>
export default {
  name: "Ybutton",
  props: {
    type: String,
    disabled: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {};
  }
};
</script>
<style scoped>
.btn_wrap{
 padding: 0 20px;
}
.y-button {
  width: 100%;
  border: none;
  outline: none;
  display: inline-block;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  color: #fff;
  background-color: #20af0e;
  border-color: #20af0e;
  text-align: center;
  box-sizing: border-box;
  outline: 0;
  padding: 12px 20px;
  font-size: 16px;
  border-radius: 4px;
  margin-top: 30px;
}
/* 获取焦点的时候和hover的时候改变颜色 */
.is-disabled,
.is-disabled:focus,
.is-disabled:hover {
  background-color: #75b56c;
  border-color: #75b56c;
  cursor: not-allowed;
  border: none;
  outline: none;
  width: 100%;
  /* 取消鼠标样式事件 */
  pointer-events: none;
  color: white;
}
</style>


